package com.quanyan.stadium.service.gameRules;

import com.quanyan.api.APIResponse;
import com.quanyan.stadium.api.req.ReqGameSchedule;
import com.quanyan.stadium.api.req.ReqRecordGameScheduleResult;
import com.quanyan.stadium.api.resp.v2.RankGameTeam;
import com.quanyan.stadium.entity.TbGameEvent;
import com.quanyan.stadium.entity.TbGameEventScore;
import com.quanyan.stadium.entity.TbGameEventTeam;
import com.quanyan.stadium.entity.TbGameRound;
import com.quanyan.stadium.entity.vo.GameTeam;
import com.quanyan.stadium.entity.vo.VDefinedGameSchedule;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 */
public interface GameScheduleService {


    /**
     * 赛事录入胜负关系
     *
     * */
    APIResponse<?> recordGameScheduleResult(Integer uid, ReqRecordGameScheduleResult req);

    /**
     * 录入赛事结果V2
     *
     * @param uid
     * @param req
     */
    int userRecordScoreV2(Integer uid, ReqRecordGameScheduleResult req);

    /**
     * 根据赛程的比赛结果,开始录入当前轮次的队伍积分 (该方法很重要,每一轮生成对战表都得生成积分; 点击赛事结束时,调起积分的生成)
     * 该模式只适用于:单循环\瑞士|混合(循环)
     *
     * */
    boolean recordGameRoundTeamScore(TbGameEvent tbGameEvent, Integer curGameRoundId, List<TbGameRound> tbGameRoundList, List<TbGameEventTeam> tbGameEventTeamList);


    /**
     * 赛程的场地和时间更新
     *
     * */
    APIResponse<?> updateGameScheduleTimeAndPlaceUnit(Integer uid, ReqGameSchedule reqGameSchedule) throws InvocationTargetException, IllegalAccessException;

    /**
     * 根据队伍信息组装队伍,转换方法,如果是双打的话,需要根据队伍的逻辑进行匹配
     * @param list  队伍的list列表
     * @param type  队伍类型,区分俱乐部or人
     *
     * */
    List<GameTeam> tbGameTeamTransferGameTeam(TbGameEvent event, List<TbGameEventTeam> list, Byte type) throws InvocationTargetException, IllegalAccessException;
    /**
     * 根据队伍信息组装队伍,转换方法,如果是双打的话,需要根据队伍的逻辑进行匹配
     * @param list  队伍的list列表
     * @param type  队伍类型,区分俱乐部or人
     *
     * */
    List<RankGameTeam> tbGameTeamTransferGameTeamV4(TbGameEvent event, List<TbGameEventTeam> list, Byte type) throws InvocationTargetException, IllegalAccessException;

    /**
     * 根据队伍信息组装队伍,转换方法,如果是双打的话,需要根据队伍的逻辑进行匹配
     * @param list  队伍的list列表
     * @param type  队伍类型,区分俱乐部or人
     *
     * */
    List<GameTeam> tbGameTeamTransferGameTeamV2(TbGameEvent event, List<TbGameEventScore> list, Byte type) throws InvocationTargetException, IllegalAccessException;


    /**
     * 根据队伍信息组装队伍,转换方法,如果是双打的话,需要根据队伍的逻辑进行匹配
     * @param list  队伍的list列表
     * @param type  队伍类型,区分俱乐部or人
     *
     * */
    List<RankGameTeam> tbGameTeamTransferGameTeamV3(TbGameEvent event, List<TbGameEventScore> list, Byte type) throws InvocationTargetException, IllegalAccessException;

    /**
     * 比分录入校验
     *
     * @param req
     * @param tbGameEvent
     * @param currentGameSchedules
     * @return
     */
    int validateRecordAuth(ReqRecordGameScheduleResult req, TbGameEvent tbGameEvent, List<VDefinedGameSchedule> currentGameSchedules);

    /**
     * 编辑对手时,更新个人赛程表数据
     *
     * */
    void updateSwissRound(TbGameRound tbGameRound, boolean isDouble);
}
